/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.appspot.nnaplanner;

import javax.jdo.annotations.*;
import java.util.List;
import java.util.Set;
import com.google.appengine.api.datastore.Key;

/**
 *
 * @author david
 */
@PersistenceCapable(identityType=IdentityType.APPLICATION)
public class Stop {

    @PrimaryKey
    private String _id;
    @Persistent
    private String _name;
    @Persistent
    private String _description;
    @Persistent
    private float _longitude;
    @Persistent
    private float _latitude;

    //Represents the relation of connections that are associated with this Stop
    // the key representst the key associated with each stop
    @Persistent
    private Set<Key> _departures;
    @Persistent
    private Set<Key> _arrivals;



 //   @NotPersistent
//    private List<Stop> _destinations;
 //   @NotPersistent
 //   private List<Connection> _departures;
 //   @NotPersistent
 //   private List<Connection> _arrivals;

    /**
     * Deafult Constructor
     * @param id - The unique ID to identify this stop. Using ATCOCode as this identifier
     * @param name - The name of the station/stop
     * @param description - A description of the stop to help Identify it

     */
    public Stop(String id, String name, String description) {
        _id = id;
        _name = name;
        _description = description;
    }

    public Stop() {
        _id = "";
        _name = "";
        _description = "";
    }

    public List<Stop> getDestinations () {
        return null;
    }

    public String getName () {
        return _name;
    }

    public String getDescription () {
        return _description;
    }

    public void setDescription (String val) {
        this._description = val;
    }

    public GeoPosition getPosition () {
        return new GeoPosition(_latitude, _longitude);
    }

    public String getID(){
        return _id;
    }

    public void setPosition (GeoPosition pos) {
        _latitude = pos.getLatitude();
        _longitude = pos.getLongitude();
    }
    
}
